package com.meitianhui.convenitenbuy.module.home.adapter;

import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.meitianhui.convenitenbuy.R;
import com.meitianhui.convenitenbuy.module.store.model.StoreInfo;

import java.util.List;

/**
 * Created by Administrator on 2017/11/28.
 */

public class NearByStoreAdapter extends BaseQuickAdapter<StoreInfo.Convenient,BaseViewHolder> {
    public NearByStoreAdapter( @Nullable List<StoreInfo.Convenient> data) {
        super(R.layout.item_home_collection, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, StoreInfo.Convenient item) {
        helper.setText(R.id.tv_name,item.getStores_name());
        helper.setText(R.id.tv_address,item.getAddress());
        if(!TextUtils.isEmpty(item.getDistance())) {
            helper.setText(R.id.tv_location,item.getDistance() + "米");
        }else{
            helper.setText(R.id.tv_location,"");
        }
    }
}
